package com.jinxin.platform.cdqzsqacs.controller;

import com.jinxin.platform.cdqzsqacs.common.SysOrgInfo;
import com.jinxin.platform.cdqzsqacs.rpc.SysUserRpc;
import com.jinxin.platform.cdqzsqacs.service.IQzsqAcsRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * All rights Reserved, Designed By www.beonelot.com
 *
 * @version: V1.0
 * @Copyright: www.beonelot.com Inc. All rights reserved.
 * @Description：
 * @Date: 2021-01-30
 * @Author: Lingnan
 **/
@RestController
@RequestMapping("/qzsqRecord")
@Slf4j
public class QzsqRecordController {

    @Autowired
    private IQzsqAcsRecordService recordService;
    @Autowired
    private SysUserRpc sysUserRpc;

    @RequestMapping("/list")
    public Map<String,Object> list(@RequestParam int page, @RequestParam int limit,
                                   @RequestParam String name, String startDate,String endDate){
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("code",0);
        resultMap.put("msg","");
//        SysOrgInfo currentOrg = sysUserRpc.getCurrentOrg();
//        if(currentOrg == null){
//            resultMap.put("count", 0);
//            resultMap.put("data", null);
//            return resultMap;
//        }
        HashMap param = new HashMap();
        param.put("page", page);
        param.put("limit", limit);
        param.put("searchKey", name);
        param.put("startDate", startDate);
        param.put("endDate", endDate);
        //param.put("communityId", currentOrg.getOrgId());
        resultMap.put("count", recordService.listPageCount(param));
        resultMap.put("data", recordService.listPage(param));
        return resultMap;
    }


}
